#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main()
{
	int fd = open("log.txt", O_RDONLY);
    if (fd < 0){
		perror("open");
		return 1;
	}

    printf("fd:%d\n",fd);
    char buffer[128];
	ssize_t s = read(fd, buffer, sizeof(buffer)-1);
	if (s>0)
    {
        buffer[s]='\n';
        printf("%s",buffer);
	}
	close(fd);
	return 0;
}